#include <clutter/clutter.h>
#include <nbtk/nbtk.h>
#include <stdio.h>
#include "simplerender.hh"
#include "mainWindow.hh"

G_DEFINE_TYPE (SimpleRenderer, simple_renderer, G_TYPE_INITIALLY_UNOWNED)

static gboolean
enter_deal_with(ClutterActor *actor,ClutterEvent *event,gpointer user_data)
{
/*
  printf("*****************************\n");
  gint depth = clutter_actor_get_depth(actor);
  clutter_actor_set_depth(actor,depth*2);
*/
} 

static gboolean
leave_deal_with(ClutterActor *actor,ClutterEvent *event,gpointer user_data)
{
/*
  printf("##############################\n");
  gint depth = clutter_actor_get_depth(actor);
  clutter_actor_set_depth(actor,depth/2);
*/
}



ClutterActor *
simple_renderer_get_actor (SimpleRenderer *renderer)
{
  NbtkWidget * button;

  button = nbtk_button_new();
  
  
  if( ((SimpleRenderer *)renderer)->width != -1)
    clutter_actor_set_size(CLUTTER_ACTOR(button), ((SimpleRenderer *)renderer)->width , ((SimpleRenderer *)renderer)->height);
    
//  g_signal_connect(CLUTTER_ACTOR(button),"enter-event",G_CALLBACK(enter_deal_with),NULL);
//  g_signal_connect(CLUTTER_ACTOR(button),"leave-event",G_CALLBACK(leave_deal_with),NULL);

 // clutter_actor_set_name(CLUTTER_ACTOR(button), "result-button");
  return (ClutterActor *)button;
}

static void
simple_renderer_class_init (SimpleRendererClass *klass)
{

}

static void
simple_renderer_init (SimpleRenderer *renderer)
{
  renderer->width = -1;
  renderer->height = -1;
}

void simple_renderer_set_actor_width(SimpleRenderer *renderer,gint width)
{
  renderer->width = width;
}
void simple_renderer_set_actor_height(SimpleRenderer *renderer,gint height)
{
  renderer->height = height;
}
